<div ng-controller="DistributorCtrl" ng-init="infoAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/distributor/list">{{'代理商'| translate}}</a></li>
        <li class="active">
            详情
        </li>
    </ul>
    <table class="sui-table table-vzebra" ng-show="distributorInfo">
        <tbody>
            <tr>
                <td>介绍</td>
                <td>{{distributorInfo.introduce}}</td>
                <td>审核原因</td>
                <td>
                    <div class="sui-form form-horizontal">
                        <textarea rows="5" ng-model="distributorInfo.reason" class="input-xlarge"></textarea>
                    </div>
                    <button type="button" class="sui-btn btn-success" ng-click="CheckUpdate(2,distributorInfo.distributor_id,distributorInfo.reason)">{{'通过审核'|translate}}</button>
                    <button type="button" class="sui-btn btn-danger" ng-click="CheckUpdate(3,distributorInfo.distributor_id,distributorInfo.reason)">{{'拒绝'|translate}}</button>
                </td>
            </tr>
            <tr>
                <td>审核状态</td>
                <td>
                    <span ng-show="distributorInfo.check ==1" class="sui-text-info">未审核</span>
                    <span ng-show="distributorInfo.check ==2" class="sui-text-success">审核通过</span>
                    <span ng-show="distributorInfo.check ==3" class="sui-text-danger">审核失败</span>
                </td>
                <td>分销商等级</td>
                <td>
                    <fxgrade-list ng-model="distributorInfo.grade_id" dft="1"></fxgrade-list>
                    <button type="button" class="sui-btn btn-success" ng-click="upgrade(distributorInfo.grade_id)">{{'保存'|translate}}</button>
                </td>
            </tr>
            <tr>
                <td>
                    待升级代理商等级
                </td>
                <td colspan="2">
                    <span ng-show="distributorInfo.upgrade_id > 0">
                        由原来的 <span style="color: #f00;"> <fxgrade-list ng-model="distributorInfo.grade_id" stype="1"></fxgrade-list> </span> 申请升级为 <span style="color: #f00;"> <fxgrade-list ng-model="distributorInfo.upgrade_id" stype="1"></fxgrade-list> </span>
                    <button class="sui-btn btn-primary" ng-click="upgrade(distributorInfo.upgrade_id,'upgrade');"> 同意 </button>
                    </span>
                    <span ng-show="!distributorInfo.upgrade_id || distributorInfo.upgrade_id == 0">
                        现在已经是 <span style="color: #f00;"> <fxgrade-list ng-model="distributorInfo.grade_id" stype="1"></fxgrade-list> </span>
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
    <div class="sui-msg msg-block msg-info">
        <div class="msg-con">代理商个人详情</div>
        <s class="msg-icon"></s>
    </div>
    <div class="sui-form form-horizontal">
        <div class="control-group">
            <label class="control-label v-top"> {{'代理商名称'| translate}}：</label>
            <div class="controls">
                <div class="zTreeDemoBackground">
                    <wxinfo ng-model="distributorInfo.user_id" stye="1"></wxinfo>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top"> {{'称呼'| translate}}：</label>
            <div class="controls">
                <div class="zTreeDemoBackground">
                    <!-- {{distributorInfo.nick_name}} -->
                    <input id="nick_name" ng-model="distributorInfo.nick_name">
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top"> {{'微信号'| translate}}：</label>
            <div class="controls">
                <div class="zTreeDemoBackground">
                    <!-- {{distributorInfo.weixin}} -->
                    <input id="weixin" ng-model="distributorInfo.weixin">
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top"> {{'手机号'| translate}}：</label>
            <div class="controls">
                <div class="zTreeDemoBackground">
                    <!-- {{distributorInfo.phone}} -->
                    <input id="phone" ng-model="distributorInfo.phone">
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <button class="sui-btn btn-primary" ng-click="upDistributorInfo();">
                    <span>{{'save' | translate}}</span>
                </button>
            </div>
        </div>
    </div>
    <div class="sui-msg msg-block msg-info">
        <div class="msg-con">代理商购物明细</div>
        <s class="msg-icon"></s>
    </div>
    <settlement-tab ng-model="chosedStatus" click-tab="orderGet(1);orderamountGet();"></settlement-tab>
    <table class="sui-table table-bordered">
        <thead>
            <tr>
                <th colspan="7">
                    <label class="checkbox pull-left">
                        订单总笔数：{{total_count}} 笔 ；订单总金额：{{orderamount?orderamount:0}} 元
                    </label>
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th>{{'#'|translate}}</th>
                <th>{{'用户昵称'|translate}}</th>
                <th>{{'订单商品'|translate}}</th>
                <th>{{'Orderid'|translate}}</th>
                <th>{{'total_fee'|translate}}</th>
                <th>{{'支付金额'|translate}}</th>
                <th>{{'buyer_nick'|translate}}</th>
            </tr>
            <tr ng-repeat="(key, list) in orderslist">
                <td>{{key+1}}</td>
                <td style="width: 60px;">
                    <wxinfo ng-model="list.member_id" stye="1"></wxinfo>
                </td>
                <td colspan="list.items.length">
                    <table class="sui-table table-bordered">
                        <tr>
                            <td>{{'主图'|translate}}</td>
                            <td>{{'title'|translate}}</td>
                            <td>{{'数量'|translate}}</td>
                        </tr>
                        <tr ng-repeat="item in list.items">
                            <td><img ng-src="{{item.image}}" width="60"></td>
                            <td><span style="display: block;width: 100px;word-wrap:break-word">{{item.title}}</span></td>
                            <td>{{item.quantity}}</td>
                        </tr>
                    </table>
                </td>
                <td style="width: 180px;">
                    {{list.created_at | ddtt}}
                    <br/> {{list.order_id}}
                    <br/><span ng-show="list.order_type==4"><pt-schedule ng-show="list.items[0].pintuan_activity_id" ng-model="list.items[0].pintuan_activity_id"></pt-schedule></span>
                    <br/>
                    <orderstatus ng-model="list.status">
                        <orderstatus>
                </td>
                <td style="width: 70px;">{{list.total_fee}}</td>
                <td style="width: 70px;">{{list.payment}}</td>
                <td>
                    <buyerlist order_id="list.order_id"></buyerlist>
                    <br/> {{list.deliver_phone}}
                    <br/>
                    <span style="display: block;width: 100px;word-wrap:break-word">{{list.province}} {{list.city}} {{list.district}} {{list.deliver_address}}</span>
                </td>
            </tr>
        </tbody>
    </table>
    <pager page-no="{{pageNo}}" page-size="pageSize" total="total_count" get-data="orderGet(pageNo)"></pager>
</div>